#pragma once
#include "Mesh.hpp"
#include "Property.hpp"
#include "TextFont.hpp"
#include "Box.hpp"

namespace Typhoon {
	class MeshLabel : public Mesh
	{
	public:
		MeshLabel();
		~MeshLabel();

		Property<MeshLabel*, Vector2> Size;
		Property<MeshLabel*, TextFont*> Font;
		Property<MeshLabel*, float> FontSize;
		Property<MeshLabel*, std::string> Text;
		Property<MeshLabel*, TextFont::HAlignment> HAlignment;
		Property<MeshLabel*, TextFont::VAlignment> VAlignment;
		Property<MeshLabel*, Box> TextureCoords;
		Property<MeshLabel*, Colour> Color;
		Property<MeshLabel*, bool> WordWrap;

		virtual const Mesh::VerticesList& ReadOnlyVertices();
		virtual const Mesh::TrianglesList& ReadOnlyTriangles();
		
	private:
		void TextChanged(MeshLabel* label);

		bool textIsDirty;

		std::vector<TextFont::Letter> letters;

		void CreateText();

		void Visualize();

	};
}

